package com.nulldev.util.crypto.encryptAPI.ice;

import com.nulldev.util.crypto.encryptAPI.manage.Encryptor;
import com.nulldev.util.encoding.base64.Base64;

public class Ice extends Encryptor {
	
	public static final int DEFAULT_LEVEL = 2;
	private int LEVEL = this.DEFAULT_LEVEL;
	
	public int getLevel() {
		return this.LEVEL;
	}
	
	public void setLevel(final int level) {
		this.LEVEL = level;
	}

	@Override
	public String getEncryptorID() {
		return "ext.ICE";
	}

	@Override
	public String[] supportedEncryptors() {
		return new String[] {"ICE", "Ice", "ice"};
	}

	@Override
	public String encrypt(String text, String password) {
		final IceKey icek = new IceKey(this.LEVEL);
		icek.set(password.getBytes());
		byte[] udec = text.getBytes();
		byte[] fdec = new byte[udec.length];
		icek.encrypt(udec, fdec);
		icek.clear();
		return Base64.encodeBase64String(fdec);
	}

	@Override
	public byte[] encryptBytes(byte[] data, String password) {
		
		return null;
	}

	@Override
	public String decrypt(String text, String password) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public byte[] decryptBytes(byte[] data, String password) {
		// TODO Auto-generated method stub
		return null;
	}

}
